const htmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path');

module.exports = {

  outputDir: 'dist',
  assetsDir: 'assets',

  productionSourceMap: process.env.NODE_ENV != "production",
  publicPath: process.env.NODE_ENV === 'production' ? '/m/' : '/',

  css: {
    sourceMap: process.env.NODE_ENV != "production",
    loaderOptions: {
      scss: {},
    }
  },

  configureWebpack: {
    plugins: [
      new htmlWebpackPlugin({
        title: '魔法云-在线教育、知识付费、政企直播服务平台',
        favicon: './public/favicon.ico',
        template: './public/index.html',
        inject: true
      }),
    ],
    externals: {},
    devServer: {
      contentBase: path.join(__dirname, 'dist'),
      compress: true,
      port: 9008,
    },
    resolve: {
      alias: {
      },
    },
  },
}